POV-Ray : Newsgroups : povray.programming : Where can I find the reflected ray? : Re: Where can I find the reflected ray? Server Time
28 Jul 2024 06:26:28 EDT (-0400)
  Re: Where can I find the reflected ray?  
From: Warp
Date: 14 Oct 2002 02:03:04
Message: <3daa5e12@news.povray.org>
Wu Yang <wya### [at] cswrightedu> wrote:
> static void Reflect(......)
> {
>   ofstream output("D:\\out.dat");
>   ......

  This is not an answer to your question per se, but do you think that's
the best way to go?
  If you open the file for writing each time Reflect() is called, this
is not only inefficient (a system call for opening a file for writing can
be quite slow if done lots and lots of times) but you will also be destroying
any previous data which existed in the file (by default ofstream opens
the file for writing, not for appending, ie. if the file existed already,
it's clamped to 0 size).
  You should only open the file once in some initialization routine, not
every time Reflect() is called.

  And by the way, it's a good idea to check if opening the file succeeded.
Don't take the success for granted.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.